const express = require("express");
const router = express.Router();
const { verifyToken } = require("../utiles/jwt");
const fileContorller = require("../contorller/fileContorller");
const multer = require("multer");
const upload = multer({ dest: "public/uploads" });

router
  //创建文件夹
  .post("/create", verifyToken(), fileContorller.createFolder)
  //获取文件夹列表
  .get("/list", verifyToken(), fileContorller.getFolderList)
  //修改文件夹名称
  .put("/rename", verifyToken(), fileContorller.renameFolder)
  //删除文件夹
  .post("/delete", verifyToken(), fileContorller.deleteFolder)
  //上传文件
  .post(
    "/upload",
    verifyToken(),
    upload.single("file"),
    fileContorller.uploadFile
  )
  ////获取对应文件夹下对应的文件
  .get("/getFiles", verifyToken(), fileContorller.getFiles)
//删除文件
.delete('/deleteFile',verifyToken(),fileContorller.deleteFile)
module.exports = router;
